/**
 * @param {number[]} nums1
 * @param {number[]} nums2
 * @return {number[][]}
 */
var findDifference = function (nums1, nums2) {
    const set1 = new Set(nums1)
    const set2 = new Set(nums2)
    set1.forEach(item => {
        if (set2.has(item)) {
            set1.delete(item)
            set2.delete(item)
        }
    })
    set2.forEach(item => {
        if (set1.has(item)) {
            set1.delete(item)
            set2.delete(item)
        }
    })
    return [Array.from(set1), Array.from(set2)]
};


console.log(findDifference([1, 2, 3], [2, 4, 6]));       // Output: [[1,3],[4,6]]
console.log(findDifference([1, 2, 3, 3], [1, 1, 2, 2]));  // Output: [[3],[]]